<?php include COMMON_PATH.'/index/header.html' ?>
<div class="se-wrap main-content fl-wrap sr-wrap clearfix">
    <div class="fl left-box">
        <div class="title">课程评价</div>
        <ul class="user-result-wrap">
            <li class="first">
                <img class="avatar" src="<?=$play['avatar']?>" onerror = "iService.imgNoFind(this)">
                <p><span class="am-icon-venus"></span><?=$play['nickname']?></p>
            </li>

            <li class="last">
                <i class="am-icon-file-text-o"></i><span class="" style="font-size: 16px;"><?=$play['name']?></span>
            </li>
            <li class="last">
                <i class="layui-icon">&#xe60e;</i><span class="" style="font-size: 16px;"><?=$play['date']?></span>
            </li>
            <li class="last">
                <i class="am-icon-pencil"></i><span class="" style="font-size: 16px;"><?=$score['count']?>条评论</span>
            </li>
            <li class="last">
                <i class="layui-icon">&#xe6c6;</i><span class="" style="font-size: 16px;"><?=$play['rate']?>%好评</span>
            </li>
            <li class="last">
                <i class="layui-icon">&#xe705;</i><span class="" style="font-size: 16px;">课程简介：</span>
                <p><?=$play['introduction']?></p>
            </li>

        </ul>
    </div>
    <div class="fr right-box">
        <div class="title">
            <span class="fr btn-forum-send">全部评价</span>
        </div>
        <div class="sr-right-box">
            <?php if(empty($score['myScore'])):?>
            <div class="score-wrap score-no-wrap clearfix">
                <div class="score-icon-wrap">
                    <span data-score="60" class="first"><i class="iconfont icon-manyiduyiban"></i>一般</span>
                    <span data-score="80" class="second"><i class="iconfont icon-manyidu1"></i>不错</span>
                    <span data-score="100" class="third active"><i class="iconfont icon-manyidutiaocha"></i>很好</span>
                </div>
                <div class="textarea-wrap" id="score-text-content">
                    <textarea name="" placeholder="评一评"></textarea>
                </div>
                <span class="score-submit fr">提交</span>
            </div>
            <?php else:?>
            <div class="score-wrap clearfix">
                <div class="score-icon-wrap">
                    <span class="first <?php if($score['myScore']['score'] <= 60):?>active<?php endif;?>"><i class="iconfont icon-manyiduyiban"></i>一般</span>
                    <span class="second <?php if($score['myScore']['score'] > 60 && $score['myScore']['score'] <= 80):?>active<?php endif;?>"><i class="iconfont icon-manyidu1"></i>不错</span>
                    <span class="third <?php if($score['myScore']['score'] > 80):?>active<?php endif;?>"><i class="iconfont icon-manyidutiaocha"></i>很好</span>
                </div>
                <div class="textarea-wrap" id="score-text-content">
                    <p><?=$score['myScore']['comment']?></p>
                </div>
                <span class="score-delete fr">删除</span>
            </div>
            <?php endif;?>
            <ul class="sr-list-wrap">
                <?php foreach($score['lists'] as $k=>$v):?>

                <li class="clearfix">
                    <img class="avatar" src="<?=$v['avatar']?>"  onerror = "iService.imgNoFind(this)"><div class="info">
                    <p><?=$v['nickname']?> - <?=$v['section']?> (<?=$v['score']?>分)</p>
                    <p><?=$v['comment']?></p>
                </div>
                    <span class="fr date"><?=$v['createtime']?></span>
                </li>
                <?php endforeach;?>
            </ul>
            <div id="live-page-wrap" data-page-total="1" data-page-per="24"><div class="layui-box layui-laypage layui-laypage-molv" id="layui-laypage-3"><a href="javascript:;" class="layui-laypage-prev layui-disabled" data-page="0">上一页</a><span class="layui-laypage-curr"><em class="layui-laypage-em" style="background-color:#1dddac;"></em><em>1</em></span><a href="javascript:;" class="layui-laypage-next layui-disabled" data-page="2">下一页</a><span class="layui-laypage-skip">到第<input type="text" min="1" value="1" class="layui-input">页<button type="button" class="layui-laypage-btn">确定</button></span></div></div>
        </div>
    </div>
</div>

<?php include COMMON_PATH.'/index/footer.html' ?>
<script src="https://cdn.jsdelivr.net/vue/latest/vue.js"></script>

<script>
    navActive(1);
    $(function(){
        layui.use(['element','layer','form', 'laypage', 'laydate'], function() {
            var layer = layui.layer //获得layer模块
                    , laypage = layui.laypage //获得laypage模块
                    , laydate = layui.laydate //获得laydate模块
                    , form = layui.form //获得laydate模块
                    , element = layui.element;

            $('.score-no-wrap .score-icon-wrap span').on('click',function(){
                $(this).addClass('active').siblings('span').removeClass('active');
            });

            $('.score-no-wrap .score-submit').on('click',function(){
                var param = {
                    url:'course/addScore',
                    data:{
                        llid: iService.getQueryString('llid'),
                        score: $('.score-no-wrap .score-icon-wrap span.active').attr('data-score'),
                        comment: $('.score-no-wrap textarea').val()
                    }

                };
                $.JsonRpc(param,function(data){
                    if(data.code==200){
                        location.reload();
                    }else {
                        layer.msg(data.data.message, {icon: 2,anim: 6,time:2*1000});
                    }

                });

            });

            $('.score-delete').on('click',function(){
                var param = {
                    url:'course/delScore',
                    data:{
                        llid: iService.getQueryString('llid'),
                    }

                };
                $.JsonRpc(param,function(data){
                    console.log(data);
                    if(data.code==200){
                        location.reload();
                    }else {
                        layer.msg(data.data.message, {icon: 2,anim: 6,time:2*1000});
                    }

                });
            });
        });
    });
</script>
</html>



















